<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        var color = ['red', 'blue', 'orange', 'white', 'black', 'pink'];
        var star = '';
        var str = '';
        for (var i = 0; i < color.length; i++) {
            star = str + '*';
            if (i == color.length - 1) {
                str = str + color[i];
            } else {
                str = str + color[i] + '*';
            }
        }
        console.log(str);
    </script>
</body>

</html>